package ${cfg.basePackage}.module.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@Doc_C(ability = "${table.comment!}控制器", author = {"${author}"}, time = "${cfg.date}")
@RestController
@RequestMapping("/${table.entityPath}/${table.entityPath}")
@Auth(auth = AuthType.PUBLIC)
public class ${entity}Ctr {
    @Autowired
    ${entity}Ser ${table.entityPath}Ser;

    /**
     * 这里是注意事项，与注解使用说明,看后删除即可
     * <p>
     * 注意： System.out.println() 和 无用的 log 记得删除或者注释
     * 注意: BaseSer中的工具类，在 SerImpl中直接 . 调用
     *
     * <p>
     * Doc_M --- 必须写
     * @Doc_M(ability = "添加数据", author = {"王永吉"}) --- 方法描述
     * <p>
     * @Doc_M(ability = "添加数据", author = {"王永吉"})
     * @RequestMapping({"/insert"}) //
     * public R add(@RequestBody ${entity} param) {
     * return ${table.entityPath}Ser.insert(param);
     * }
     */

    @Doc_M(ability = "添加一条数据", author = {"王永吉"})
    @RequestMapping({"/insert"})
    public R insert(@RequestBody ${entity} param) {
    return ${table.entityPath}Ser.insert(param);
    }

    @Doc_M(ability = "删除数据", author = {"王永吉"})
    @RequestMapping({"/delete"})
    public R delete(@RequestBody Long[] ids) {
    return ${table.entityPath}Ser.delete(ids);
    }

    @Doc_M(ability = "修改一条数据", author = {"王永吉"})
    @RequestMapping({"/update"})
    public R update(@RequestBody ${entity} param) {
    return ${table.entityPath}Ser.update(param);
    }

    @Doc_M(ability = "查询数据集合", author = {"王永吉"})
    @RequestMapping({"/list"})
    public R list(@RequestBody ${entity} param) {
    return ${table.entityPath}Ser.list(param);
    }

    @Doc_M(ability = "分页查询数据", author = {"王永吉"})
    @RequestMapping("/page")
    public R page(@RequestBody R param) {
    return ${table.entityPath}Ser.page(param);
    }

    @Doc_M(ability = "查询一条数据", author = {"王永吉"})
    @RequestMapping("/one")
    public R one(@RequestBody R param) {
    return ${table.entityPath}Ser.one(param);
    }
}
